

import os,sys,re
from process import Process
##urllib,urllib2

def start(procName,filePath):
    proc=list(Process.GetProcessByName(procName))
    if not len(proc):
        print('Starting %s '%procName)
        os.startfile(filePath)  

if __name__ == '__main__':    
    appMap={'firefox.exe':'firefox.bat',
##            'talk.exe':'talk',
            'RTX.exe':'rtx',
            'MSDEV.exe':'msdev',
            'DM2005.exe':'dm',
##	          'elu.exe':'elu',
##            'strokeit.exe':'strokeit',
            }

    for procName in appMap.keys():
        start(procName,appMap[procName])
    print('调查当天的下载记录')
        
    
##def tryLogon():
##    '''测试并尝试登陆网络，即该函数执行后一定是可以联网的'''
##    if not islogon():
##        import urllib
##        params=urllib.urlencode({'mymethod':'login',
##            'un':'xmli',
##            'up':'cdybjsbfhw',
##            'set_language':''
##            })
##        response=urllib.urlopen('http://192.77.107.1:3333/cgi/auth_check',params)
##    import time
##    time.sleep(0.5)
##    assert islogon()
##
##def islogon():
##    '''测试当前是否已经登陆网络'''
##    text=urllib2.urlopen('http://www.baidu.com').read()
##    p=re.compile(r'192.77.107.1:3333')
##    if p.search(text):
##        return False
##    return True

